using System;
namespace ch.ethz.ssh2
{
	
	/// <summary> A <code>HTTPProxyData</code> object is used to specify the needed connection data
	/// to connect through a HTTP proxy. 
	/// 
	/// </summary>
	/// <seealso cref="Connection.setProxyData(ProxyData)">
	/// 
	/// </seealso>
	/// <author>  Christian Plattner
	/// </author>
	/// <version>  2.50, 03/15/10
	/// </version>
	
	public class HTTPProxyData : ProxyData
	{
		//UPGRADE_NOTE: Final was removed from the declaration of 'proxyHost '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
		public System.String proxyHost;
		//UPGRADE_NOTE: Final was removed from the declaration of 'proxyPort '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
		public int proxyPort;
		//UPGRADE_NOTE: Final was removed from the declaration of 'proxyUser '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
		public System.String proxyUser;
		//UPGRADE_NOTE: Final was removed from the declaration of 'proxyPass '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
		public System.String proxyPass;
		//UPGRADE_NOTE: Final was removed from the declaration of 'requestHeaderLines '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
		public System.String[] requestHeaderLines;
		
		/// <summary> Same as calling {@link #HTTPProxyData(String, int, String, String) HTTPProxyData(proxyHost, proxyPort, <code>null</code>, <code>null</code>)}
		/// 
		/// </summary>
		/// <param name="proxyHost">Proxy hostname.
		/// </param>
		/// <param name="proxyPort">Proxy port.
		/// </param>
		public HTTPProxyData(System.String proxyHost, int proxyPort):this(proxyHost, proxyPort, null, null)
		{
		}
		
		/// <summary> Same as calling {@link #HTTPProxyData(String, int, String, String, String[]) HTTPProxyData(proxyHost, proxyPort, <code>null</code>, <code>null</code>, <code>null</code>)}
		/// 
		/// </summary>
		/// <param name="proxyHost">Proxy hostname.
		/// </param>
		/// <param name="proxyPort">Proxy port.
		/// </param>
		/// <param name="proxyUser">Username for basic authentication (<code>null</code> if no authentication is needed).
		/// </param>
		/// <param name="proxyPass">Password for basic authentication (<code>null</code> if no authentication is needed).
		/// </param>
		public HTTPProxyData(System.String proxyHost, int proxyPort, System.String proxyUser, System.String proxyPass):this(proxyHost, proxyPort, proxyUser, proxyPass, null)
		{
		}
		
		/// <summary> Connection data for a HTTP proxy. It is possible to specify a username and password
		/// if the proxy requires basic authentication. Also, additional request header lines can
		/// be specified (e.g., "User-Agent: CERN-LineMode/2.15 libwww/2.17b3").
		/// <p>
		/// Please note: if you want to use basic authentication, then both <code>proxyUser</code>
		/// and <code>proxyPass</code> must be non-null.
		/// <p>
		/// Here is an example:
		/// <p>
		/// <code>
		/// new HTTPProxyData("192.168.1.1", "3128", "proxyuser", "secret", new String[] {"User-Agent: GanymedBasedClient/1.0", "X-My-Proxy-Option: something"});
		/// </code>
		/// 
		/// </summary>
		/// <param name="proxyHost">Proxy hostname.
		/// </param>
		/// <param name="proxyPort">Proxy port.
		/// </param>
		/// <param name="proxyUser">Username for basic authentication (<code>null</code> if no authentication is needed).
		/// </param>
		/// <param name="proxyPass">Password for basic authentication (<code>null</code> if no authentication is needed).
		/// </param>
		/// <param name="requestHeaderLines">An array with additional request header lines (without end-of-line markers)
		/// that have to be sent to the server. May be <code>null</code>.
		/// </param>
		
		public HTTPProxyData(System.String proxyHost, int proxyPort, System.String proxyUser, System.String proxyPass, System.String[] requestHeaderLines)
		{
			if (proxyHost == null)
				throw new System.ArgumentException("proxyHost must be non-null");
			
			if (proxyPort < 0)
				throw new System.ArgumentException("proxyPort must be non-negative");
			
			this.proxyHost = proxyHost;
			this.proxyPort = proxyPort;
			this.proxyUser = proxyUser;
			this.proxyPass = proxyPass;
			this.requestHeaderLines = requestHeaderLines;
		}
	}
}